Friend Enum AuditExecutionMode
     None = 0
     ExecStart = 1
     ExecEnd = 2
End Enum

Friend Enum AuditExecutionStatus
     NotApplicable = -1
     Fail = 0
     Success = 1
     GetFromVariable = 2
End Enum

Friend Enum AuditRunAsMaster
     NotApplicable = -1
     No = 0
     Yes = 1
     Always = 2
End Enum

Friend Enum AuditTableAction
     NotApplicable = -1
     AutoCount = 0
     GetCountFromVariable = 1
     GetCountByQuery = 2
End Enum

<System.Serializable()> Friend Class AuditConfig
#Region "Declares"
#Region "Default Value Constants"
     'Audit Level
     Private _AuditDatabaseConnectionNameConst As String = ""
     Private _AuditDatabaseConnectionGUIDConst As String = ""
     Private _sUserSelectedTaskNameConst As String = ""

     'Package Execution
     Private _AuditPackageExecutionModeConst As AuditExecutionMode = AuditExecutionMode.None
     Private _AuditPackageRunAsMasterConst As AuditRunAsMaster = AuditRunAsMaster.NotApplicable
     Private _AuditParentPackageExecutionIdVariableNameConst As String = ""
     Private _AuditThisPackageExecutionIdVariableNameConst As String = ""
     Private _AuditPackageExecutionStatusConst As AuditExecutionStatus = AuditExecutionStatus.NotApplicable
     Private _AuditPackageExecutionVariableNameConst As String = ""

     'Table Execution
     Private _AuditTableExecutionModeConst As AuditExecutionMode = AuditExecutionMode.None
     Private _AuditedDatabaseConnectionNameConst As String = ""
     Private _AuditedDatabaseConnectionGUIDConst As String = ""
     Private _AuditTableExecutionIdVariableNameConst As String = ""
     Private _AuditTableSchemaNameConst As String = ""
     Private _AuditTableNameConst As String = ""
     Private _AuditTableStartRowCountActionConst As AuditTableAction = AuditTableAction.NotApplicable
     Private _AuditTableStartRowCountVariableNameConst As String = ""
     Private _AuditTableStartRowCountQueryConst As String = ""
     Private _AuditTableUpdateRowCountVariableNameConst As String = ""
     Private _AuditTableInsertRowCountActionConst As AuditTableAction = AuditTableAction.NotApplicable
     Private _AuditTableInsertRowCountVariableNameConst As String = ""
     Private _AuditTableInsertRowCountQueryConst As String = ""
     Private _AuditTableDeleteRowCountVariableNameConst As String = ""
     Private _AuditTableErrorRowCountVariableNameConst As String = ""
     Private _AuditTableEndingRowCountActionConst As AuditTableAction = AuditTableAction.NotApplicable
     Private _AuditTableEndingRowCountVariableNameConst As String = ""
     Private _AuditTableEndingRowCountQueryConst As String = ""
     Private _AuditTableExecutionStatusConst As AuditExecutionStatus = AuditExecutionStatus.NotApplicable
     Private _AuditTableExecutionVariableNameConst As String = ""
#End Region

     'Audit Level
     Private _AuditDatabaseConnectionName As String = _AuditDatabaseConnectionNameConst
     Private _AuditDatabaseConnectionGUID As String = _AuditDatabaseConnectionGUIDConst
     Private _sUserSelectedTaskName As String = _sUserSelectedTaskNameConst

     'Package Execution
     Private _AuditPackageExecutionMode As AuditExecutionMode = _AuditPackageExecutionModeConst
     Private _AuditPackageRunAsMaster As AuditRunAsMaster = _AuditPackageRunAsMasterConst
     Private _AuditParentPackageExecutionIdVariableName As String = _AuditParentPackageExecutionIdVariableNameConst
     Private _AuditThisPackageExecutionIdVariableName As String = _AuditThisPackageExecutionIdVariableNameConst
     Private _AuditPackageExecutionStatus As AuditExecutionStatus = _AuditPackageExecutionStatusConst
     Private _AuditPackageExecutionVariableName As String = _AuditPackageExecutionVariableNameConst

     'Table Execution
     Private _AuditTableExecutionMode As AuditExecutionMode = _AuditTableExecutionModeConst
     Private _AuditedDatabaseConnectionName As String = _AuditedDatabaseConnectionNameConst
     Private _AuditedDatabaseConnectionGUID As String = _AuditedDatabaseConnectionGUIDConst
     Private _AuditTableExecutionIdVariableName As String = _AuditTableExecutionIdVariableNameConst
     Private _AuditTableSchemaName As String = _AuditTableSchemaNameConst
     Private _AuditTableName As String = _AuditTableNameConst
     Private _AuditTableStartRowCountAction As AuditTableAction = _AuditTableStartRowCountActionConst
     Private _AuditTableStartRowCountVariableName As String = _AuditTableStartRowCountVariableNameConst
     Private _AuditTableStartRowCountQuery As String = _AuditTableStartRowCountQueryConst
     Private _AuditTableUpdateRowCountVariableName As String = _AuditTableUpdateRowCountVariableNameConst
     Private _AuditTableInsertRowCountAction As AuditTableAction = _AuditTableInsertRowCountActionConst
     Private _AuditTableInsertRowCountVariableName As String = _AuditTableInsertRowCountVariableNameConst
     Private _AuditTableInsertRowCountQuery As String = _AuditTableInsertRowCountQueryConst
     Private _AuditTableDeleteRowCountVariableName As String = _AuditTableDeleteRowCountVariableNameConst
     Private _AuditTableErrorRowCountVariableName As String = _AuditTableErrorRowCountVariableNameConst
     Private _AuditTableEndingRowCountAction As AuditTableAction = _AuditTableEndingRowCountActionConst
     Private _AuditTableEndingRowCountVariableName As String = _AuditTableEndingRowCountVariableNameConst
     Private _AuditTableEndingRowCountQuery As String = _AuditTableEndingRowCountQueryConst
     Private _AuditTableExecutionStatus As AuditExecutionStatus = _AuditTableExecutionStatusConst
     Private _AuditTableExecutionVariableName As String = _AuditTableExecutionVariableNameConst
#End Region

#Region "Publicly Exposed"
#Region "Ctor"
     ''' <summary>
     ''' Build a new object with all default starting values
     ''' </summary>
     Public Sub New()
          'Accept all default values
     End Sub

     ''' <summary>
     ''' Build a new object for an audit that includes only Package auditing.
     ''' </summary>
     ''' <param name="AuditDatabaseConnectionName">Audit Database Connection Name</param>
     ''' <param name="AuditDatabaseConnectionGUID">Audit Database Connection GUID</param>
     ''' <param name="AuditPackageExecutionMode">Package Execution Mode, indicates whether we will be doing package auditing and what end of the process we are handling</param>
     ''' <param name="AuditPackageRunAsMaster">Indicates whether during a package execution audit that this package can be run by itself or if it MUST be called by a parent package</param>
     ''' <param name="AuditParentPackageExecutionIdVariableName">Name of Variable that contains the Package Execution Id of the package calling this one, this is used to tie the packages called by a master package together</param>
     ''' <param name="AuditThisPackageExecutionIdVariableName">Name of Variable that contains the Package Execution Id, this is used to tie the start and end audits together</param>
     ''' <param name="AuditPackageExecutionStatus">Package Execution Status</param>
     ''' <param name="AuditPackageExecutionVariableName">Name of Package Execution Status Variable</param>
     ''' <param name="AuditTableExecutionMode">Table Action Mode, indicates whether we will be doing table auditing and what end of the process we are handling</param>
     Public Sub New(ByVal AuditDatabaseConnectionName As String, _
                    ByVal AuditDatabaseConnectionGUID As String, _
                    ByVal AuditPackageExecutionMode As AuditExecutionMode, _
                    ByVal AuditPackageRunAsMaster As AuditRunAsMaster, _
                    ByVal AuditParentPackageExecutionIdVariableName As String, _
                    ByVal AuditThisPackageExecutionIdVariableName As String, _
                    ByVal AuditPackageExecutionStatus As AuditExecutionStatus, _
                    ByVal AuditPackageExecutionVariableName As String, _
                    ByVal AuditTableExecutionMode As AuditExecutionMode)
          'Audit Level
          _AuditDatabaseConnectionName = AuditDatabaseConnectionName.Trim
          _AuditDatabaseConnectionGUID = AuditDatabaseConnectionGUID.Trim

          'Package Execution
          _AuditPackageExecutionMode = AuditPackageExecutionMode
          _AuditPackageRunAsMaster = AuditPackageRunAsMaster
          _AuditParentPackageExecutionIdVariableName = AuditParentPackageExecutionIdVariableName.Trim
          _AuditThisPackageExecutionIdVariableName = AuditThisPackageExecutionIdVariableName.Trim
          _AuditPackageExecutionStatus = AuditPackageExecutionStatus
          _AuditPackageExecutionVariableName = AuditPackageExecutionVariableName.Trim
     End Sub

     ''' <summary>
     ''' Build a new object for an audit that includes only Table auditing.
     ''' </summary>
     ''' <param name="AuditDatabaseConnectionName">Audit Database Connection Name</param>
     ''' <param name="AuditDatabaseConnectionGUID">Audit Database Connection GUID</param>
     ''' <param name="AuditedDatabaseConnectionName">Database Connection Name for the database being audited</param>
     ''' <param name="AuditedDatabaseConnectionGUID">Database Connection GUID for the database being audited</param>
     ''' <param name="AuditTableExecutionIdVariableName">Name of Variable that contains the Table Execution Id, this is used to tie the start and end audits together</param>
     ''' <param name="AuditTableSchemaName">Schema name of the table being audited (ownership)</param>
     ''' <param name="AuditTableName">Table name of the table being audited</param>
     ''' <param name="AuditTableStartRowCountAction">Starting Row Table Action to determine the starting row count</param>
     ''' <param name="AuditTableStartRowCountVariableName">Name of Variable that contains the Starting Row Count</param>
     ''' <param name="AuditTableStartRowCountQuery">Text of query to determine the Starting Row Count</param>
     ''' <param name="AuditTableUpdateRowCountVariableName">Name of Variable that contains the Updated Row Count</param>
     ''' <param name="AuditTableInsertRowCountAction">Inserted Row Table Action to determine the inserted row count</param>
     ''' <param name="AuditTableInsertRowCountVariableName">Name of Variable that contains the Inserted Row Count</param>
     ''' <param name="AuditTableInsertRowCountQuery">Text of query to determine the Inserted Row Count</param>
     ''' <param name="AuditTableDeleteRowCountVariableName">Name of Variable that contains the Deleted Row Count</param>
     ''' <param name="AuditTableErrorRowCountVariableName">Name of Variable that contains the Error Row Count</param>
     ''' <param name="AuditTableEndingRowCountAction">Ending Row Table Action to determine the Ending Row Count</param>
     ''' <param name="AuditTableEndingRowCountVariableName">Name of Variable that contains the Ending Row Count</param>
     ''' <param name="AuditTableEndingRowCountQuery">Text of query to determine the Ending Row Count</param>
     ''' <param name="AuditTableExecutionStatus">Table Action Status</param>
     ''' <param name="AuditTableExecutionVariableName">GUID of Table Action Status Variable</param>
     Public Sub New(ByVal AuditDatabaseConnectionName As String, _
                    ByVal AuditDatabaseConnectionGUID As String, _
                    ByVal AuditedDatabaseConnectionName As String, _
                    ByVal AuditedDatabaseConnectionGUID As String, _
                    ByVal AuditTableExecutionIdVariableName As String, _
                    ByVal AuditTableSchemaName As String, _
                    ByVal AuditTableName As String, _
                    ByVal AuditTableStartRowCountAction As AuditTableAction, _
                    ByVal AuditTableStartRowCountVariableName As String, _
                    ByVal AuditTableStartRowCountQuery As String, _
                    ByVal AuditTableUpdateRowCountVariableName As String, _
                    ByVal AuditTableInsertRowCountAction As AuditTableAction, _
                    ByVal AuditTableInsertRowCountVariableName As String, _
                    ByVal AuditTableInsertRowCountQuery As String, _
                    ByVal AuditTableDeleteRowCountVariableName As String, _
                    ByVal AuditTableErrorRowCountVariableName As String, _
                    ByVal AuditTableEndingRowCountAction As AuditTableAction, _
                    ByVal AuditTableEndingRowCountVariableName As String, _
                    ByVal AuditTableEndingRowCountQuery As String, _
                    ByVal AuditTableExecutionStatus As AuditExecutionStatus, _
                    ByVal AuditTableExecutionVariableName As String)
          'Audit Level
          _AuditDatabaseConnectionName = AuditDatabaseConnectionName.Trim
          _AuditDatabaseConnectionGUID = AuditDatabaseConnectionGUID.Trim

          'Table Execution
          _AuditTableExecutionMode = AuditTableExecutionMode
          _AuditedDatabaseConnectionName = AuditedDatabaseConnectionName.Trim
          _AuditedDatabaseConnectionGUID = AuditedDatabaseConnectionGUID.Trim
          _AuditTableExecutionIdVariableName = AuditTableExecutionIdVariableName.Trim
          _AuditTableSchemaName = AuditTableSchemaName.Trim
          _AuditTableName = AuditTableName.Trim
          _AuditTableStartRowCountAction = AuditTableStartRowCountAction
          _AuditTableStartRowCountVariableName = AuditTableStartRowCountVariableName.Trim
          _AuditTableStartRowCountQuery = AuditTableStartRowCountQuery.Trim
          _AuditTableUpdateRowCountVariableName = AuditTableUpdateRowCountVariableName.Trim
          _AuditTableInsertRowCountAction = AuditTableInsertRowCountAction
          _AuditTableInsertRowCountVariableName = AuditTableInsertRowCountVariableName.Trim
          _AuditTableInsertRowCountQuery = AuditTableInsertRowCountQuery.Trim
          _AuditTableDeleteRowCountVariableName = AuditTableDeleteRowCountVariableName.Trim
          _AuditTableErrorRowCountVariableName = AuditTableErrorRowCountVariableName.Trim
          _AuditTableEndingRowCountAction = AuditTableEndingRowCountAction
          _AuditTableEndingRowCountVariableName = AuditTableEndingRowCountVariableName.Trim
          _AuditTableEndingRowCountQuery = AuditTableEndingRowCountQuery.Trim
          _AuditTableExecutionStatus = AuditTableExecutionStatus
          _AuditTableExecutionVariableName = AuditTableExecutionVariableName.Trim
     End Sub

     ''' <summary>
     ''' Build a new object for an audit that includes both Package and Table auditing.
     ''' </summary>
     ''' <param name="AuditDatabaseConnectionName">Audit Database Connection Name</param>
     ''' <param name="AuditDatabaseConnectionGUID">Audit Database Connection GUID</param>
     ''' <param name="AuditPackageExecutionMode">Package Execution Mode, indicates whether we will be doing package auditing and what end of the process we are handling</param>
     ''' <param name="AuditPackageRunAsMaster">Indicates whether during a package execution audit that this package can be run by itself or if it MUST be called by a parent package</param>
     ''' <param name="AuditParentPackageExecutionIdVariableName">Name of Variable that contains the Package Execution Id of the package calling this one, this is used to tie the packages called by a master package together</param>
     ''' <param name="AuditThisPackageExecutionIdVariableName">Name of Variable that contains the Package Execution Id, this is used to tie the start and end audits together</param>
     ''' <param name="AuditPackageExecutionStatus">Package Execution Status</param>
     ''' <param name="AuditPackageExecutionVariableName">Name of Package Execution Status Variable</param>
     ''' <param name="AuditTableExecutionMode">Table Action Mode, indicates whether we will be doing table auditing and what end of the process we are handling</param>
     ''' <param name="AuditedDatabaseConnectionName">Database Connection Name for the database being audited</param>
     ''' <param name="AuditedDatabaseConnectionGUID">Database Connection GUID for the database being audited</param>
     ''' <param name="AuditTableExecutionIdVariableName">Name of Variable that contains the Table Execution Id, this is used to tie the start and end audits together</param>
     ''' <param name="AuditTableSchemaName">Schema name of the table being audited (ownership)</param>
     ''' <param name="AuditTableName">Table name of the table being audited</param>
     ''' <param name="AuditTableStartRowCountAction">Starting Row Table Action to determine the starting row count</param>
     ''' <param name="AuditTableStartRowCountVariableName">Name of Variable that contains the Starting Row Count</param>
     ''' <param name="AuditTableStartRowCountQuery">Text of query to determine the Starting Row Count</param>
     ''' <param name="AuditTableUpdateRowCountVariableName">Name of Variable that contains the Updated Row Count</param>
     ''' <param name="AuditTableInsertRowCountAction">Inserted Row Table Action to determine the inserted row count</param>
     ''' <param name="AuditTableInsertRowCountVariableName">Name of Variable that contains the Inserted Row Count</param>
     ''' <param name="AuditTableInsertRowCountQuery">Text of query to determine the Inserted Row Count</param>
     ''' <param name="AuditTableDeleteRowCountVariableName">Name of Variable that contains the Deleted Row Count</param>
     ''' <param name="AuditTableErrorRowCountVariableName">Name of Variable that contains the Error Row Count</param>
     ''' <param name="AuditTableEndingRowCountAction">Ending Row Table Action to determine the Ending Row Count</param>
     ''' <param name="AuditTableEndingRowCountVariableName">Name of Variable that contains the Ending Row Count</param>
     ''' <param name="AuditTableEndingRowCountQuery">Text of query to determine the Ending Row Count</param>
     ''' <param name="AuditTableExecutionStatus">Table Action Status</param>
     ''' <param name="AuditTableExecutionVariableName">GUID of Table Action Status Variable</param>
     Public Sub New(ByVal AuditDatabaseConnectionName As String, _
                    ByVal AuditDatabaseConnectionGUID As String, _
                    ByVal AuditPackageExecutionMode As AuditExecutionMode, _
                    ByVal AuditPackageRunAsMaster As AuditRunAsMaster, _
                    ByVal AuditParentPackageExecutionIdVariableName As String, _
                    ByVal AuditThisPackageExecutionIdVariableName As String, _
                    ByVal AuditPackageExecutionStatus As AuditExecutionStatus, _
                    ByVal AuditPackageExecutionVariableName As String, _
                    ByVal AuditTableExecutionMode As AuditExecutionMode, _
                    ByVal AuditedDatabaseConnectionName As String, _
                    ByVal AuditedDatabaseConnectionGUID As String, _
                    ByVal AuditTableExecutionIdVariableName As String, _
                    ByVal AuditTableSchemaName As String, _
                    ByVal AuditTableName As String, _
                    ByVal AuditTableStartRowCountAction As AuditTableAction, _
                    ByVal AuditTableStartRowCountVariableName As String, _
                    ByVal AuditTableStartRowCountQuery As String, _
                    ByVal AuditTableUpdateRowCountVariableName As String, _
                    ByVal AuditTableInsertRowCountAction As AuditTableAction, _
                    ByVal AuditTableInsertRowCountVariableName As String, _
                    ByVal AuditTableInsertRowCountQuery As String, _
                    ByVal AuditTableDeleteRowCountVariableName As String, _
                    ByVal AuditTableErrorRowCountVariableName As String, _
                    ByVal AuditTableEndingRowCountAction As AuditTableAction, _
                    ByVal AuditTableEndingRowCountVariableName As String, _
                    ByVal AuditTableEndingRowCountQuery As String, _
                    ByVal AuditTableExecutionStatus As AuditExecutionStatus, _
                    ByVal AuditTableExecutionVariableName As String)
          'Audit Level
          _AuditDatabaseConnectionName = AuditDatabaseConnectionName.Trim
          _AuditDatabaseConnectionGUID = AuditDatabaseConnectionGUID.Trim

          'Package Execution
          _AuditPackageExecutionMode = AuditPackageExecutionMode
          _AuditPackageRunAsMaster = AuditPackageRunAsMaster
          _AuditParentPackageExecutionIdVariableName = AuditParentPackageExecutionIdVariableName.Trim
          _AuditThisPackageExecutionIdVariableName = AuditThisPackageExecutionIdVariableName.Trim
          _AuditPackageExecutionStatus = AuditPackageExecutionStatus
          _AuditPackageExecutionVariableName = AuditPackageExecutionVariableName.Trim

          'Table Execution
          _AuditTableExecutionMode = AuditTableExecutionMode
          _AuditedDatabaseConnectionName = AuditedDatabaseConnectionName.Trim
          _AuditedDatabaseConnectionGUID = AuditedDatabaseConnectionGUID.Trim
          _AuditTableExecutionIdVariableName = AuditTableExecutionIdVariableName.Trim
          _AuditTableSchemaName = AuditTableSchemaName.Trim
          _AuditTableName = AuditTableName.Trim
          _AuditTableStartRowCountAction = AuditTableStartRowCountAction
          _AuditTableStartRowCountVariableName = AuditTableStartRowCountVariableName.Trim
          _AuditTableStartRowCountQuery = AuditTableStartRowCountQuery.Trim
          _AuditTableUpdateRowCountVariableName = AuditTableUpdateRowCountVariableName.Trim
          _AuditTableInsertRowCountAction = AuditTableInsertRowCountAction
          _AuditTableInsertRowCountVariableName = AuditTableInsertRowCountVariableName.Trim
          _AuditTableInsertRowCountQuery = AuditTableInsertRowCountQuery.Trim
          _AuditTableDeleteRowCountVariableName = AuditTableDeleteRowCountVariableName.Trim
          _AuditTableErrorRowCountVariableName = AuditTableErrorRowCountVariableName.Trim
          _AuditTableEndingRowCountAction = AuditTableEndingRowCountAction
          _AuditTableEndingRowCountVariableName = AuditTableEndingRowCountVariableName.Trim
          _AuditTableEndingRowCountQuery = AuditTableEndingRowCountQuery.Trim
          _AuditTableExecutionStatus = AuditTableExecutionStatus
          _AuditTableExecutionVariableName = AuditTableExecutionVariableName.Trim
     End Sub
#End Region

#Region "Properties"
#Region "Audit Level"
     Public Property AuditDatabaseConnectionName() As String
          Get
               Return _AuditDatabaseConnectionName
          End Get
          Set(ByVal value As String)
               _AuditDatabaseConnectionName = value.Trim
          End Set
     End Property

     Public Property AuditDatabaseConnectionGUID() As String
          Get
               Return _AuditDatabaseConnectionGUID
          End Get
          Set(ByVal value As String)
               _AuditDatabaseConnectionGUID = value.Trim
          End Set
     End Property

     Public Property UserSelectedTaskName() As String
          Get
               Return _sUserSelectedTaskName
          End Get
          Set(ByVal value As String)
               _sUserSelectedTaskName = value.Trim
          End Set
     End Property
#End Region

#Region "Package Execution"
     Public Property AuditPackageExecutionMode() As AuditExecutionMode
          Get
               Return _AuditPackageExecutionMode
          End Get
          Set(ByVal value As AuditExecutionMode)
               _AuditPackageExecutionMode = value
          End Set
     End Property

     Public Property AuditPackageRunAsMaster() As AuditRunAsMaster
          Get
               Return _AuditPackageRunAsMaster
          End Get
          Set(ByVal value As AuditRunAsMaster)
               _AuditPackageRunAsMaster = value
          End Set
     End Property

     Public Property AuditParentPackageExecutionIdVariableName() As String
          Get
               Return _AuditParentPackageExecutionIdVariableName
          End Get
          Set(ByVal value As String)
               _AuditParentPackageExecutionIdVariableName = value.Trim
          End Set
     End Property

     Public Property AuditThisPackageExecutionIdVariableName() As String
          Get
               Return _AuditThisPackageExecutionIdVariableName
          End Get
          Set(ByVal value As String)
               _AuditThisPackageExecutionIdVariableName = value.Trim
          End Set
     End Property

     Public Property AuditPackageExecutionStatus() As AuditExecutionStatus
          Get
               Return _AuditPackageExecutionStatus
          End Get
          Set(ByVal value As AuditExecutionStatus)
               _AuditPackageExecutionStatus = value
          End Set
     End Property

     Public Property AuditPackageExecutionVariableName() As String
          Get
               Return _AuditPackageExecutionVariableName
          End Get
          Set(ByVal value As String)
               _AuditPackageExecutionVariableName = value.Trim
          End Set
     End Property
#End Region

#Region "Table Execution"
     Public Property AuditTableExecutionMode() As AuditExecutionMode
          Get
               Return _AuditTableExecutionMode
          End Get
          Set(ByVal value As AuditExecutionMode)
               _AuditTableExecutionMode = value
          End Set
     End Property

     Public Property AuditedDatabaseConnectionName() As String
          Get
               Return _AuditedDatabaseConnectionName
          End Get
          Set(ByVal value As String)
               _AuditedDatabaseConnectionName = value.Trim
          End Set
     End Property

     Public Property AuditedDatabaseConnectionGUID() As String
          Get
               Return _AuditedDatabaseConnectionGUID
          End Get
          Set(ByVal value As String)
               _AuditedDatabaseConnectionGUID = value.Trim
          End Set
     End Property

     Public Property AuditTableExecutionIdVariableName() As String
          Get
               Return _AuditTableExecutionIdVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableExecutionIdVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableSchemaName() As String
          Get
               Return _AuditTableSchemaName
          End Get
          Set(ByVal value As String)
               _AuditTableSchemaName = value.Trim
          End Set
     End Property

     Public Property AuditTableName() As String
          Get
               Return _AuditTableName
          End Get
          Set(ByVal value As String)
               _AuditTableName = value.Trim
          End Set
     End Property

     Public Property AuditTableStartRowCountAction() As AuditTableAction
          Get
               Return _AuditTableStartRowCountAction
          End Get
          Set(ByVal value As AuditTableAction)
               _AuditTableStartRowCountAction = value
          End Set
     End Property

     Public Property AuditTableStartRowCountVariableName() As String
          Get
               Return _AuditTableStartRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableStartRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableStartRowCountQuery() As String
          Get
               Return _AuditTableStartRowCountQuery
          End Get
          Set(ByVal value As String)
               _AuditTableStartRowCountQuery = value.Trim
          End Set
     End Property

     Public Property AuditTableUpdateRowCountVariableName() As String
          Get
               Return _AuditTableUpdateRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableUpdateRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableInsertRowCountAction() As AuditTableAction
          Get
               Return _AuditTableInsertRowCountAction
          End Get
          Set(ByVal value As AuditTableAction)
               _AuditTableInsertRowCountAction = value
          End Set
     End Property

     Public Property AuditTableInsertRowCountVariableName() As String
          Get
               Return _AuditTableInsertRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableInsertRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableInsertRowCountQuery() As String
          Get
               Return _AuditTableInsertRowCountQuery
          End Get
          Set(ByVal value As String)
               _AuditTableInsertRowCountQuery = value.Trim
          End Set
     End Property

     Public Property AuditTableDeleteRowCountVariableName() As String
          Get
               Return _AuditTableDeleteRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableDeleteRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableErrorRowCountVariableName() As String
          Get
               Return _AuditTableErrorRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableErrorRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableEndingRowCountAction() As AuditTableAction
          Get
               Return _AuditTableEndingRowCountAction
          End Get
          Set(ByVal value As AuditTableAction)
               _AuditTableEndingRowCountAction = value
          End Set
     End Property

     Public Property AuditTableEndingRowCountVariableName() As String
          Get
               Return _AuditTableEndingRowCountVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableEndingRowCountVariableName = value.Trim
          End Set
     End Property

     Public Property AuditTableEndingRowCountQuery() As String
          Get
               Return _AuditTableEndingRowCountQuery
          End Get
          Set(ByVal value As String)
               _AuditTableEndingRowCountQuery = value.Trim
          End Set
     End Property

     Public Property AuditTableExecutionStatus() As AuditExecutionStatus
          Get
               Return _AuditTableExecutionStatus
          End Get
          Set(ByVal value As AuditExecutionStatus)
               _AuditTableExecutionStatus = value
          End Set
     End Property

     Public Property AuditTableExecutionVariableName() As String
          Get
               Return _AuditTableExecutionVariableName
          End Get
          Set(ByVal value As String)
               _AuditTableExecutionVariableName = value.Trim
          End Set
     End Property
#End Region
#End Region

#Region "Methods"
     Public Sub CleanConfig()
          CleanPackageLevel()
          CleanTableLevel()
     End Sub

     Public Function ValidateConfig(ByVal componentEvents As IDTSComponentEvents) As Boolean
          Dim _sPackageValidationMessages As String
          Dim _sTableValidationMessages As String
          Dim _sValidationMessages As String = ""

          _sPackageValidationMessages = ValidatePackageLevel()
          _sTableValidationMessages = ValidateTableLevel()

          If _sPackageValidationMessages = "" And _sTableValidationMessages = "" Then
               _sValidationMessages = ""
          ElseIf Not _sPackageValidationMessages = "" And _sTableValidationMessages = "" Then
               _sValidationMessages = "Package Audit Setup Error(s): " & _sPackageValidationMessages
          ElseIf _sPackageValidationMessages = "" And Not _sTableValidationMessages = "" Then
               _sValidationMessages = "Table Audit Setup Error(s): " & _sTableValidationMessages
          ElseIf Not _sPackageValidationMessages = "" And Not _sTableValidationMessages = "" Then
               _sValidationMessages = "Package Audit Setup Error(s): " _
                                    & _sPackageValidationMessages _
                                    & "Table Audit Setup Error(s): " _
                                    & _sTableValidationMessages
          End If

          'Return an error if there is one..
          If Not _sValidationMessages = "" Then
               componentEvents.FireError(0, "Audit Control (NCL)", _sValidationMessages, "", 0)

               Return False
          End If

          Return True
     End Function
#End Region
#End Region

#Region "Private Code"
#Region "Private Code Used By Clean Config"
#Region "Package Execution"
     Private Sub CleanPackageLevel()
          If _AuditPackageExecutionMode = AuditExecutionMode.None Then
               _AuditPackageRunAsMaster = _AuditPackageRunAsMasterConst
               _AuditParentPackageExecutionIdVariableName = _AuditParentPackageExecutionIdVariableNameConst
               _AuditThisPackageExecutionIdVariableName = _AuditThisPackageExecutionIdVariableNameConst
               _AuditPackageExecutionStatus = _AuditPackageExecutionStatusConst
               _AuditPackageExecutionVariableName = _AuditPackageExecutionVariableNameConst
          End If

          If _AuditPackageExecutionMode = AuditExecutionMode.ExecStart Then
               _AuditPackageExecutionStatus = _AuditPackageExecutionStatusConst
               _AuditPackageExecutionVariableName = _AuditPackageExecutionVariableNameConst
          End If

          If _AuditPackageExecutionMode = AuditExecutionMode.ExecEnd Then
               _AuditPackageRunAsMaster = _AuditPackageRunAsMasterConst
               _AuditParentPackageExecutionIdVariableName = _AuditParentPackageExecutionIdVariableNameConst
               _AuditThisPackageExecutionIdVariableName = _AuditThisPackageExecutionIdVariableNameConst
          End If
     End Sub
#End Region

#Region "Table Execution"
     Private Sub CleanTableLevel()
          If _AuditTableExecutionMode = AuditExecutionMode.None Then
               _AuditedDatabaseConnectionName = _AuditedDatabaseConnectionNameConst
               _AuditedDatabaseConnectionGUID = _AuditedDatabaseConnectionGUIDConst
               _AuditTableExecutionIdVariableName = _AuditTableExecutionIdVariableNameConst
               _AuditTableSchemaName = _AuditTableSchemaNameConst
               _AuditTableName = _AuditTableNameConst
               _AuditTableStartRowCountAction = _AuditTableStartRowCountActionConst
               _AuditTableStartRowCountVariableName = _AuditTableStartRowCountVariableNameConst
               _AuditTableStartRowCountQuery = _AuditTableStartRowCountQueryConst
               _AuditTableUpdateRowCountVariableName = _AuditTableUpdateRowCountVariableNameConst
               _AuditTableInsertRowCountAction = _AuditTableInsertRowCountActionConst
               _AuditTableInsertRowCountVariableName = _AuditTableInsertRowCountVariableNameConst
               _AuditTableInsertRowCountQuery = _AuditTableInsertRowCountQueryConst
               _AuditTableDeleteRowCountVariableName = _AuditTableDeleteRowCountVariableNameConst
               _AuditTableErrorRowCountVariableName = _AuditTableErrorRowCountVariableNameConst
               _AuditTableEndingRowCountAction = _AuditTableEndingRowCountActionConst
               _AuditTableEndingRowCountVariableName = _AuditTableEndingRowCountVariableNameConst
               _AuditTableEndingRowCountQuery = _AuditTableEndingRowCountQueryConst
               _AuditTableExecutionStatus = _AuditTableExecutionStatusConst
               _AuditTableExecutionVariableName = _AuditTableExecutionVariableNameConst
          End If

          If _AuditTableExecutionMode = AuditExecutionMode.ExecStart Then
               _AuditTableUpdateRowCountVariableName = _AuditTableUpdateRowCountVariableNameConst
               _AuditTableInsertRowCountAction = _AuditTableInsertRowCountActionConst
               _AuditTableInsertRowCountVariableName = _AuditTableInsertRowCountVariableNameConst
               _AuditTableInsertRowCountQuery = _AuditTableInsertRowCountQueryConst
               _AuditTableDeleteRowCountVariableName = _AuditTableDeleteRowCountVariableNameConst
               _AuditTableErrorRowCountVariableName = _AuditTableErrorRowCountVariableNameConst
               _AuditTableEndingRowCountAction = _AuditTableEndingRowCountActionConst
               _AuditTableEndingRowCountVariableName = _AuditTableEndingRowCountVariableNameConst
               _AuditTableEndingRowCountQuery = _AuditTableEndingRowCountQueryConst
               _AuditTableExecutionStatus = _AuditTableExecutionStatusConst
               _AuditTableExecutionVariableName = _AuditTableExecutionVariableNameConst
          End If

          If _AuditTableExecutionMode = AuditExecutionMode.ExecEnd Then
               _AuditTableStartRowCountAction = _AuditTableStartRowCountActionConst
               _AuditTableStartRowCountVariableName = _AuditTableStartRowCountVariableNameConst
               _AuditTableStartRowCountQuery = _AuditTableStartRowCountQueryConst
          End If
     End Sub
#End Region
#End Region

#Region "Private Code Used By Validate Config"
     Private Function ValidatePackageLevel() As String

          Return ""
     End Function

     Private Function ValidateTableLevel() As String

          Return ""
     End Function
#End Region
#End Region

End Class
